package com.codemeta.bokit.mybatis.core.validation.annotation;

import com.baomidou.mybatisplus.extension.service.IService;
import com.codemeta.bokit.mybatis.core.validation.PrimaryKeyValidator;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import javax.validation.Constraint;
import javax.validation.Payload;

/**
 * 主键是否存在 注解
 *
 * @author hice
 * @date 2021/12/06
 */
@Target({
    ElementType.METHOD,
    ElementType.FIELD,
    ElementType.ANNOTATION_TYPE,
    ElementType.CONSTRUCTOR,
    ElementType.PARAMETER,
    ElementType.TYPE_USE
})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Constraint(validatedBy = PrimaryKeyValidator.class)
public @interface PrimaryKey {

    /**
     * 指定service业务接口类数组
     *
     * @return .
     */
    Class<? extends IService>[] value() default {};

    String message() default "数据不存在";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}